﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FishGenerate : MonoBehaviour {

    public TextAsset textAsset;

    //储存所有的鱼
    public Dictionary<int, FishData> DictFish = new Dictionary<int, FishData>();

    //生成鱼
    public void GenerateFish()
    {
        string[] lines = textAsset.text.Split("\n"[0]);

        foreach(string str in lines)
        {
            string[] s = str.Split(","[0]);
            FishData fData = new FishData();
            fData.FishID1 = int.Parse(s[0]);
            fData.FishName = s[1];
            fData.Weapon = s[2];
            fData.WeaponAttri = int.Parse(s[3]);
            fData.Atk = int.Parse(s[4]);
            fData.Def = int.Parse(s[5]);
            fData.Hp = int.Parse(s[6]);
            fData.Sp = Random.Range(0, 100);
            fData.Hit = int.Parse(s[8]);
            fData.Dodge = int.Parse(s[9]);
            fData.Crit = int.Parse(s[10]);
            fData.Anti_crit = int.Parse(s[11]);
            fData.Crit_multiple = int.Parse(s[12]);
            fData.Crit_derate = int.Parse(s[13]);
            fData.Lucky = int.Parse(s[14]);
            fData.Injury = int.Parse(s[15]);
            fData.Injury_free = int.Parse(s[16]);
            fData.Mana = int.Parse(s[17]);
            fData.MaxHp = int.Parse(s[6]);
            fData.Buff = s[19];
            fData.SkillType = int.Parse(s[18]);

            //加入字典
            DictFish.Add(fData.FishID1, fData);
        }
    }
}
